package com.system.commonutils.utils;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    /**
     * 获取当前系统时间 转换成数据库datetime类型
     * @return
     */
    public static Timestamp getDate(){
        Date date = new Date();
        //设置日期格式
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // Formats a Date into a date/time string.
        String dateTime = df.format(date);
        //二、Date转换为Datetime
        long longTime = date.getTime();
        Timestamp timestamp = new Timestamp(longTime);
        return  timestamp;
    }

}
